import request from "@/request/request";
import requestMock from "@/request/request.mock";
//请求三级列表
export const reqCategoryList = ()=>{
    return  request.get("/product/getBaseCategoryList")
}

export const reqBannerList = ()=>{
    return requestMock.get("/home/banner")
}

export const reqFloorList = ()=>{
    return requestMock.get("/home/floor")
}

export const reqSearchList = (searchParams)=>{
    return request.post("/list",searchParams)
}

export const reqDetailList = (skuId)=>{
    return request.get(`/item/${skuId}`)
}

export const reqAddToCart = (skuId,skuNum)=>{
    return request.post(`/cart/addToCart/${ skuId }/${ skuNum }`)
}

export const reqCartList = ()=>{
    return request.get(`/cart/cartList`)
}

export const reqDeleteCart = (skuId)=>{
    return request.delete(`/cart/deleteCart/${skuId}`)
}

export const reqCheckCart = (skuId,isChecked)=>{
    return request.get(`/cart/checkCart/${skuId}/${isChecked}`)
}

export const reqAllCheckCart = (isChecked,skuIdList)=>{
    return request.post(`/cart/batchCheckCart/${isChecked}`,skuIdList)
}

export const reqAllDeleteCheck = (skuIdList)=>{
    return request.delete("/cart/batchDeleteCart",{
        data:skuIdList
    })
}

export const reqCode = (phone)=>{
    return request.get(`/user/passport/sendCode/${phone}`)
}

export const reqRegister = (userInfo)=>{
    return request.post(`/user/passport/register`,userInfo)
}

export  const reqLogin = (userInfo)=>{
    return request.post(`/user/passport/login`,userInfo)
}

export const reqUserInfo = ()=>{
    return request.get("/user/passport/auth/getUserInfo")
}

export const reqLogout = ()=>{
    return request.get("/user/passport/logout")
}

export const reqUserAddress = ()=>{
    return requestMock.get(`/user/userAddress/auth/findUserAddressList`)
}

export const reqTradeList = ()=>{
    return request.get("/order/auth/trade")
}

export const reqPayTrade = (tradeNo,tradeList)=>{
    return request.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`,tradeList)
}

export const reqPayment = (orderId)=>{
    return request.get(`/payment/weixin/createNative/${orderId}`)
}

export const reqPayStatus = (orderId)=>{
    return request.get(`/payment/weixin/queryPayStatus/${orderId}`)
}